//
//  AppointmentInfoView.m
//  QuickCure
//
//  Created by 凉气的Mac on 16/9/13.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "AppointmentInfoView.h"

@interface AppointmentInfoView ()

@property(nonatomic,weak) UILabel *addressLabel;

@end

@implementation AppointmentInfoView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        //设置界面
        [self setupUI];
        
    }
    return self;
}

#pragma mark --
#pragma mark --设置界面
-(void)setupUI{
    
    //地点label
    UILabel *addressLabel = [self addTitleLabelWithString:@"就诊地点:"];
    
    self.addressLabel = addressLabel;
    
    //取号时间
    UILabel *timeLabel = [self addTitleLabelWithString:@"取号时间:"];
    
    [timeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(addressLabel);
        
        make.top.equalTo(addressLabel.mas_bottom).offset(20);
        
    }];
    
    //区号地址
    UILabel *addLabel = [self addTitleLabelWithString:@"取号地址:"];
    
    [addLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(addressLabel);
        
        make.top.equalTo(timeLabel.mas_bottom).offset(20);
        
    }];
    
    //就诊地点
    UILabel *addressInfo = [self addInfoLabelWithString:@"上海长征医院2号楼心血管内科"];
    
    //取号时间
    UILabel *timeInfo = [self addInfoLabelWithString:@"9:00 - 10:00"];
    
    [timeInfo mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(addLabel.mas_right).offset(20);
        
        make.bottom.equalTo(timeLabel);
        
    }];
    
    //取号地址
    UILabel *addInfo = [self addInfoLabelWithString:@"上海长征医院住院部"];
    
    [addInfo mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(addLabel.mas_right).offset(20);
        
        make.bottom.equalTo(addLabel);
        
    }];
    
    
    
    
}

#pragma mark --
#pragma mark --添加标题label
-(UILabel *)addTitleLabelWithString:(NSString *)string{
    
    UILabel *label = [[UILabel alloc]init];
    
    label.text = string;
    
    label.font = BOLDFONT(15);
    
    [self addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self).offset(15);
        
        make.top.equalTo(self).offset(20);
        
    }];
    
    return label;
}

#pragma mark --
#pragma mark --添加信息label
-(UILabel *)addInfoLabelWithString:(NSString *)string{
    
    UILabel *label = [[UILabel alloc]init];
    
    label.font = kFONT13;
    
    label.textColor = [UIColor colorWithWhite:0.800 alpha:1.000];
    
    label.text = string;
    
    [self addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.addressLabel.mas_right).offset(20);
        
        make.bottom.equalTo(self.addressLabel);
        
        
    }];
    
    return label;
}

@end
